package com.telit.firecommand.model.camera;

import com.telit.common.exception.ForestBaseException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


/**
 * 根据行政区划编码批量查询
 *
 * @author yuezhuang
 * @date 2022-09-08
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "QryDistrictListByCodesRequest", description = "根据行政区划编码批量查询")
public class QryDistrictListByCodesRequest implements Serializable {

    private static final long serialVersionUID = -1L;

    @ApiModelProperty(value = "当前用户所属行政区划", required = true)
    private String districtCode;

    @ApiModelProperty(value = "监控类型 1防火监控2防盗监控3卡口监控")
    private String type;

    @ApiModelProperty(value = "在线  1在线 0离线")
    private String online;

    @ApiModelProperty(value = "监控名称")
    private String cameraName;

    @ApiModelProperty(value = "待查询的行政区划code列表，和 cameraIdList 两者必须有一者有值")
    private List<String> districtCodeList = new ArrayList<>();

    @ApiModelProperty(value = "待查询的监控id列表， 和 districtCodeList 两者必须有一者有值")
    private List<String> cameraIdList = new ArrayList<>();

    public void validateAndThrow() {
        if (CollectionUtils.isEmpty(districtCodeList) && CollectionUtils.isEmpty(cameraIdList)) {
            throw new ForestBaseException("参数districtCodeList和cameraIdList不能同时为空");
        }
    }

}
